from pyspark import SparkContext, SparkConf

conf = SparkConf().setAppName("map").setMaster("local")
sc = SparkContext(conf=conf)

rdd = sc.parallelize([("a", "1"), ("b", "2"), ("a", "3"), ("c", "4")])

result = rdd.reduceByKey(lambda x, y: x + y)

print(result.collect())